import 'package:app/services/address.dart';
import 'package:app/services/dio_manager.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:get/get.dart';
import 'my_calendar_detail_model.dart';
class MyCalendarDetailController extends GetxController{




  /// 修改日程状态

  requestDataWithState(var state)async{

    var params = {
      'calendar_id':Get.arguments,
      'state':state,
    };

    var json = await DioManager().kkRequest(Address.calendarEventState,bodyParams: params);

    BotToast.showText(text: json['message']);

  }
  /// 删除日程
  requestDataWithUnlink()async{
    var params = {
      'calendar_id':Get.arguments,
    };
    var json = await DioManager().kkRequest(Address.calendarUnlink,bodyParams: params);
    Get.back(result: 'refresh');
    BotToast.showText(text: json['message']);
  }




  /// 获取详情
  ///
  ///

   MyCalendarDetailModel? model;

  requestDataWithDetail()async{

    var json = await DioManager().kkRequest('${Address.calendarRead}/${Get.arguments}',method: 'get');

    MyCalendarDetailModel _model = MyCalendarDetailModel.fromJson(json);

    model = _model;

    update();

  }

  @override
  void onInit() {
    // TODO: implement onInit
    super.onInit();

    requestDataWithDetail();
  }
}